<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>es6新特性</title>
</head>
<body>


</body>

<script>


    //箭头函数, 类似 lambda表达式
    setTimeout(() => {
        console.log('延迟');
    }, 1000);



    //模板字面量
    const student = {
        name: 'Richard Kalehoff',
        guardian: 'Mr. Kalehoff'
    };

    const teacher = {
        name: 'Mrs. Wilson',
        room: 'N231'
    };

    let message = student.name + ' please see ' + teacher.name + ' in ' + teacher.room + ' to pick up your report card.';
    let messageNew = `${student.name} please see ${teacher.name} in ${teacher.room} to pick up your report card.`;   //使用占位符
    console.log( 'message ==> '  + message  );
    console.log( 'messageNew  ==> '  + messageNew  );

    //for of 循环 类似于 Java 中的 增强for
    const digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    for (const digit of digits) {
        console.log(digit);
    }


    //展开运算符 类似于Java中的 public void getParam( Object ...  )  可变参数个数

    const books = ["金瓶梅", "母猪的产后护理", "C++从入门到入土", "计算机程序设计艺术"];
    console.log(...books);

    //流式处理
    const upperNames = ['Farrin', 'Kagure', 'Asser'].map(
        name => name.toUpperCase()
    );
    console.log( 'upperNames ==> '  + upperNames  );



</script>


</html>
